import { bubbleSort } from './冒泡排序';

test('bubbleSort case1', () => {
    const data = [1, 2, 3, 4, 5, 6];
    expect(bubbleSort(data)).toEqual(data.sort((a, b) => a - b))
});

test('bubbleSort case2', () => {
    const data = [1, 6, 4, 2, 5, 9, 0, 9];
    expect(bubbleSort(data)).toEqual(data.sort((a, b) => a - b))
});

test('bubbleSort case3', () => {
    const data: number[] = [];
    expect(bubbleSort(data)).toEqual(data.sort((a, b) => a - b))
});

test('bubbleSort case4', () => {
    const data = [1];
    expect(bubbleSort(data)).toEqual(data.sort((a, b) => a - b))
});

test('bubbleSort case5', () => {
    const data = [1, 1, 1, 0, 0, 0, -1];
    expect(bubbleSort(data)).toEqual(data.sort((a, b) => a - b))
});

test('bubbleSort case6', () => {
    const data = [-1, -11, -101, 0, 20, 30, -99];
    expect(bubbleSort(data)).toEqual(data.sort((a, b) => a - b))
});